/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.trainee.aplikasipenjualan.entity;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 *
 * @author Jaka
 */

@Entity
@Table(name="t_penjualan_header")
public class JualHeader {
    
    @Id
    @Column(name="no_faktur")
    private Integer noFaktur;
    
    @Temporal(TemporalType.TIMESTAMP)
    private Date tglFaktur;
    
    @Column(name="konsumen")
    private String konsumen;
    
    @Column(name="total")
    private BigDecimal total;
    
    
//    @Cascade(value= CascadeType.ALL)
//    @OneToMany(mappedBy = "hd", orphanRemoval=true)
//    private List<PenjualanDetail> detail;

    
    //SETTER GETTER
//    public List<PenjualanDetail> getDetail() {
//        return detail;
//    }
//
//    public void setDetail(List<PenjualanDetail> detail) {
//        this.detail = detail;
//    }

    public String getKonsumen() {
        return konsumen;
    }

    public void setKonsumen(String konsumen) {
        this.konsumen = konsumen;
    }

    public Integer getNoFaktur() {
        return noFaktur;
    }

    public void setNoFaktur(Integer noFaktur) {
        this.noFaktur = noFaktur;
    }

    public Date getTglFaktur() {
        return tglFaktur;
    }

    public void setTglFaktur(Date tglFaktur) {
        this.tglFaktur = tglFaktur;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal() {
        this.total = new PenjualanDetail().getHarga().multiply(new BigDecimal(new PenjualanDetail().getQuantity()));
    }
    
}
